package iterator;

public class ConcreteIterator implements Iterator {

    private Aggregate aggregate;

    private int cursor = 0;

    public ConcreteIterator(Aggregate aggregate) {
        this.aggregate = aggregate;
    }

    @Override
    public Object firstItem() {
        return aggregate.get(0);
    }

    @Override
    public boolean hasNext() {
        return cursor < aggregate.size() - 1;
    }

    @Override
    public Object next() {
        return aggregate.get(cursor++);
    }

    @Override
    public Object currentItem() {
        return aggregate.get(cursor);
    }
}
